Substitute character

A substitute character () is a control character that is used in the place of a character that is recognized to be invalid or in error or that cannot be represented on a given device.

In the ASCII and Unicode character sets, this character is encoded by the number 26 (1A hex). Standard keyboards transmit this code when the <kbd class="keyboard-key" style="border: 1px solid; border-color: #ddd #bbb #bbb #ddd; border-bottom-width: 2px; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; background-color: #f9f9f9; padding: 1px 3px; font-family: inherit; font-size: 0.85em; white-space: nowrap;">Ctrl</kbd> and <kbd class="keyboard-key" style="border: 1px solid; border-color: #ddd #bbb #bbb #ddd; border-bottom-width: 2px; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; background-color: #f9f9f9; padding: 1px 3px; font-family: inherit; font-size: 0.85em; white-space: nowrap;">Z</kbd> keys are pressed simultaneously (Ctrl+Z, by convention often described as ^Z).

Uses

In DOS operating systems, this character is used to indicate the end of a file (EOF) or the end of user input in an interactive command line window (and, as such, often used to finish console input redirection, f.e. as in COPY CON: TYPEDTXT.TXT). This behavior was borrowed from the earlier CP/M operating system, where it was still necessary to explicitly mark the end of a file, because the filesystem could not record the file size and files were allocated in extents of a fixed size typically leaving some allocated but unused space at the end of each file. This was filled up with 1A hex characters under CP/M. While no longer technically required many text editors and program languages today still support this convention or can be configured to insert this character at the end of a file when editing or at least cope with them in files.

In Unix operating systems, this character is typically used to suspend the currently executing interactive process. The suspended process can then be resumed in foreground (interactive) mode, or be made to resume execution in background mode, or be terminated.

The Unicode Security Considerations report suggests this character as a safe replacement for unmappable characters during character set conversion.

References

See also